#include<iostream>
#include<unistd.h>
#include<signal.h>
#include<sys/types.h>
#include<cstdio>

using namespace std;
// 模拟实现系统调用的kill

int main(int argc, char* argv[])
{
    if(argc != 3)
    {
        cout << "\nUsage: " << argv[0] << " pid signo\n" << endl;
        exit(1);
    }
    pid_t pid = atoi(argv[1]);
    int signo = atoi(argv[2]);
    int n = kill(pid, signo); //利用系统调用发送信号
    if(n != 0)
    {
        perror("kill error");
        exit(1);
    }
}